﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Enyim.Caching;
using Enyim.Caching.Configuration;

namespace AFT.Parking.Foundation.Caching
{
    /// <summary>
    /// Memcached 管理操作类
    /// </summary>
    public sealed class MemcachedManager
    {
        private static MemcachedClient mc = null;

        private static string[] serverList = null;

        static MemcachedManager()
        {
            Init();
        }

        /// <summary>
        /// 建立Manager
        /// </summary>
        private static void Init()
        {
            mc = new MemcachedClient(MemcachedConfig.config);
        }

        /// <summary>
        /// 服务器列表
        /// </summary>
        public static string[] ServerList
        {
            get
            {
                return serverList;
            }
            set
            {
                if (value != null)
                    serverList = value;
            }
        }

        /// <summary>
        /// 客户端缓存管理对象
        /// </summary>
        public static MemcachedClient Client
        {
            get
            {
                if (mc == null)
                    Init();
                return mc;
            }
        }
    }
}
